package o;

import android.content.Context;
import android.content.Intent;
import com.huawei.appgallery.appcomment.impl.bean.CollectCommentResBean;
import com.huawei.appgallery.appcomment.impl.bean.GetCommentResBean.AppCommentInfo;
import com.huawei.appgallery.serverreqkit.api.bean.ResponseBean;
import com.huawei.appgallery.serverreqkit.api.listener.IServerCallBack;
import java.lang.ref.WeakReference;
import o.bcg.h;
import o.bdm.e;

public class bdq implements IServerCallBack {
    private AppCommentInfo ˊ;
    private WeakReference<Context> ˋ;
    private int ˏ;
    private String ॱ;

    public bdq(AppCommentInfo appCommentInfo, String str, int i, Context context) {
        this.ॱ = str;
        this.ˏ = i;
        this.ˊ = appCommentInfo;
        this.ˋ = new WeakReference(context);
    }

    public void prePostResult(BaseRequest o_cvu, ResponseBean responseBean) {
    }

    public void notifyResult(BaseRequest o_cvu, ResponseBean responseBean) {
        Context context = (Context) this.ˋ.get();
        if (context != null) {
            int i;
            boolean z;
            e eVar = new e();
            if (!(responseBean instanceof CollectCommentResBean) || responseBean.getResponseCode() != 0) {
                i = h.ॱﾟ;
                z = false;
            } else if (responseBean.getRtnCode_() == 0) {
                if (this.ˏ == 1) {
                    eVar.ˋ(0);
                }
                if (this.ˊ != null && this.ˏ == 0) {
                    eVar.ˋ(1);
                }
                if (this.ˏ == 0) {
                    r1 = h.ʾ;
                } else {
                    r1 = h.ʻॱ;
                }
                i = r1;
                z = true;
            } else if (responseBean.getRtnCode_() == 1) {
                r1 = h.ॱᐝ;
                if (this.ˏ == 0) {
                    eVar.ˋ(1);
                    i = r1;
                    z = true;
                } else {
                    i = r1;
                    z = true;
                }
            } else {
                i = this.ˏ == 0 ? h.ॱˋ : h.ॱˎ;
                z = false;
            }
            ˊ(i, context, z, eVar);
        }
    }

    private void ˊ(int i, Context context, boolean z, e eVar) {
        if (i > 0) {
            ckv.ˎ(context.getString(i), 0);
        }
        if (z) {
            Intent intent = new Intent("com.huawei.appmarket.service.broadcast.CommentCollect");
            if (this.ˊ != null) {
                eVar.ˎ(this.ˊ.ʽ());
                eVar.ॱ(this.ˊ.ʼॱ());
                eVar.ˋ(this.ˊ.ॱ());
                intent.putExtra("ACTION_PARAM_COMMENT_CANCEL_COLLECT_TYPE_COMMENTID", eVar);
            } else {
                intent.putExtra("ACTION_PARAM_COMMENT_CANCEL_COLLECT_TYPE_COMMENTID", this.ॱ);
            }
            ll.ˏ(context).ˋ(intent);
        }
    }
}
